<?php 
$user=$session->read('User');
$companyid=$session->read("companyid");
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
    	<h2>
		<?php 
		$companyname=$session->read("companyname");		
		//$companyyear=$session->read("economicyear");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid)."&nbsp;"."&nbsp;".'研发费用投入清单';
		?>
    	</h2>
    	<div class='clear'></div>
    </div>
    <div class="right back_btn">
		<?php 
			echo $html->link("返回","/companys/deplist/");
    	?>
	</div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
	<div class="detail_info_panel">
		<?php 
		echo $form -> create('DevelopmentList', array('url'=>'/companys/editdeplist','enctype'=>'multipart/form-data') ); 
		?>
		<div class="details_item_line">
			<div class="details_item">
				<div class="form_left_title left">项目名称：</div>
				<div class="form_right_input left"><?php echo $form->value('DevelopmentList.name');?></div>
			</div>			
		</div>
		<div class="details_item_line">
			<div class="details_item">
				<div class="form_left_title left">起始日期：</div>
				<div class="form_right_input form_date_picker left">
				<?php 
					$start_date = $form->value('DevelopmentList.start_date');
					echo date("Y-m-d",strtotime($start_date));
				?>
				</div>
			</div>			
		</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">完成日期：</div>
					<div class="form_right_input form_date_picker left">
						<?php 
							$finish_date = $form->value('DevelopmentList.finish_date');
							echo date("Y-m-d",strtotime($finish_date));
						?>
					</div>
				</div>			
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">所处阶段：</div>
					<div class="form_right_input left">
						<?php echo $form->value('DevelopmentList.stage');?>
					</div>
					
				</div>			
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">预期投入：</div>
					<div class="form_right_input left">
						<?php echo $form->value('DevelopmentList.ex_investment');?>￥
					</div>		
				</div>
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">项目投入：</div>
					<div class="form_right_input left">
						<?php echo $form->value('DevelopmentList.act_investment');?>￥
					</div>		
				</div>
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">累计投入：</div>
					<div class="form_right_input left">
						<?php echo $form->value('DevelopmentList.total_investment');?>￥
					</div>		
				</div>
			</div>
			<div class="details_item_line">
				<div class="details_item">
				    <div class="form_left_title left">是否备案：</div>
				    <div class="form_right_input left">
				    	<?php 
				        	$record = $form->value('DevelopmentList.record');
				        	echo $str->getisflag($record);
				        ?>
				    </div>
				</div>
			</div> 
			<div class="details_item_line">  
            <div class="details_item">
                <div class="form_left_title left"><?php echo "附件" ;?>：</div>
                <div class="left">
                	<div class="file_category_list">
		        		<div id="filelist0" class="file_lists">
		        			<?php $dan="'";
			                	if($attachments){?>
<!--		        			<ul class="picture_attach">-->
		        				<?php
			                	foreach($attachments as $attachment){
			                			$fname=$attachment["file_name"];
			                			$fpath=$attachment["file_path"];
			                			$fid=$attachment["id"];
			                			$createdtime=date("Y-m-d",strtotime($attachment["created"]));
			                			$isimg=$str->checkimg($fname);
			                			if($isimg){
			                				echo "<ul class='picture_attach'>";
											echo "<li>";
											echo '<div class="picture_info">';
											echo "<span>".$fname."</span>";
											echo "<span class='source_upload_date'>".$createdtime.$html->link("下载",'/projects/download/'.$attachment["id"],null)."</span>";
											echo "</div>";
											
											if($user['isadmin'] || $user['isgroupadmin'] || $second_ownerid==$user['id']){
												echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
											}
											$img=$html->image("/".$fpath);
											echo "<span>".$html->link($img,'javascript:void(0);',array('onclick'=>"openimg(".$dan."f".$fid.$dan.")",'escape' => false))."</span>";
											echo "<div style='display:none' id='f".$fid."' title='".$fname."'>".$img."</div>";
											
											echo "</li>";
										}
									}
			                	?>
		        				<div class="clear"></div>
		        			</ul>
<!--		        			<ul class="file_attach">-->
			                	<?php
			                	foreach($attachments as $attachment){
			                			$fname=$attachment["file_name"];
			                			$isimg=$str->checkimg($fname);
			                			if(!$isimg){
			                				echo "<ul class='file_attach'>";
											echo "<li>";
											echo "<span>".$html->link($fname,'/projects/download/'.$attachment["id"],null)."</span>";
											echo "<span class='source_upload_date'>".date("Y-m-d",strtotime($attachment["created"]))."</span>";
											if($user['isadmin'] || $user['isgroupadmin'] || $second_ownerid==$user['id']){
												echo '<span class="source_upload_delete"><a title="删除" onclick="delfile(this,'.$dan.$attachment["id"].$dan.',0)" href="javascript:void(0)"></a></span>';
											}
											echo "</li>";
										}
									}
			                	?>
			                	<div class="clear"></div>
			                </ul>
			                <?php 
			                	}else{
									echo '<div class="form_right_input left">暂无文件</div>';
								}
			                ?>
		                </div>
		             </div>
				</div>
            </div>
        </div>
	</div>
</div>
<?php echo $this->element('delfileconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>
<?php echo $javascript->link('project.js');?>
<script>
function checkdinfo(){
	if($("#DevelopmentListName").val().trim() == ''){
		$("#namemsg").css('display','block');
		return false;
	}else{
		$("#namemsg").css('display','none');
	}
	
	if($("#DevelopmentListStartDate").val().trim() == ''){
		$("#sdatemsg").css('display','block');
		return false;
	}else{
		$("#sdatemsg").css('display','none');
	}
	
	if($("#DevelopmentListFinishDate").val().trim() == ''){
		$("#fdatemsg").css('display','block');
		return false;
	}else{
		$("#fdatemsg").css('display','none');
	}
}
</script>	